#!/bin/bash
rm -rf /opt/module/hadoop/apache-maven-3.6.3/

URL=https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-2.10.0/hadoop-2.10.0.tar.gz
source ../linux/download_unzip.sh "hadoop" $URL
echo ">> $File_HOME"

# 未添加过，则配置HADOOP环境变量
if (( 0 == `cat /etc/profile | grep HADOOP_HOME | wc -l` )); then
sudo cat >>/etc/profile<<EOF

#===== 配置HADOOP_HOME环境变量 =====
export HADOOP_HOME=$File_HOME
export PATH=\$PATH:\$HADOOP_HOME/bin
export PATH=\$PATH:\$HADOOP_HOME/sbin
EOF
fi


# 刷新环境变量
source /etc/profile
# java -version
echo "HADOOP版本信息完成"
hadoop version
echo "完成"

#================ 测试运行程序 ===================
# mkdir $File_HOME/input
# cp $File_HOME/etc/hadoop/*.xml input
# $File_HOME/bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar grep input output 'dfs[a-z.]+'